/**
 * 建立ws连接, 与exe通信, 在千牛端进行操作
 */


/**
 * 依据淘宝单号等关键词获取卖家昵称
 */
async function getBuyerNicksByKeys(keys) {
    const res = await QN.app.invoke({
        api: "invokeMTopChannelService",
        query: {
            method: "mtop.taobao.qianniu.airisland.contact.search",
            param: {
                accessKey: "qianniu-pc",
                accessSecret: "qianniu-pc-secret",
                accountType: "3",
                searchQuery: keys,
            },
            httpMethod: "post",
            version: "1.0",
        },
    })

    return res.data.result.map(item => item.nick)
}

/**
 * 将
 */
function insertText2Inputbox(uid, text) {
    QN.app
        .invoke({
            api: "insertText2Inputbox",
            query: {
                uid: "cntaobao雨端网络",
                text: "我是内容",
                type: 0,
            },
        })
        .then((rsp) => {
            console.log(rsp)
        })
        .catch((err) => {
            console.log(err)
        })
}